/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

@Entity
public class Inventory implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id; //only 27 rows - 4 bars 23 raw materials
    private Double quantity; //bar for product, kg for raw material
    @OneToOne
    private Product product;
    @OneToOne
    private RawMaterial rawMaterial;
    @OneToMany(cascade = {CascadeType.ALL})
    private List<TrackingItem> trackingItems = new ArrayList<TrackingItem>();

    public Inventory() {
    }

    public Inventory(Double quantity, Product product, RawMaterial rawMaterial, List<TrackingItem> trackingItems) {
        this.quantity = quantity;
        this.product = product;
        this.rawMaterial = rawMaterial;
        this.trackingItems = trackingItems;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return the quantity
     */
    public Double getQuantity() {
        return quantity;
    }

    /**
     * @param quantity the quantity to set
     */
    public void setQuantity(Double quantity) {
        this.quantity = quantity;
    }

    /**
     * @return the product
     */
    public Product getProduct() {
        return product;
    }

    /**
     * @param product the product to set
     */
    public void setProduct(Product product) {
        this.product = product;
    }

    /**
     * @return the rawMaterial
     */
    public RawMaterial getRawMaterial() {
        return rawMaterial;
    }

    /**
     * @param rawMaterial the rawMaterial to set
     */
    public void setRawMaterial(RawMaterial rawMaterial) {
        this.rawMaterial = rawMaterial;
    }

    /**
     * @return the trackingItems
     */
    public List<TrackingItem> getTrackingItems() {
        return trackingItems;
    }

    /**
     * @param trackingItems the trackingItems to set
     */
    public void setTrackingItems(List<TrackingItem> trackingItems) {
        this.trackingItems = trackingItems;
    }
}
